<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
<link rel="stylesheet" type="text/css" href="template/default/content/css/style.css">
<script language="javascript" type="text/javascript" src="DatePicker/WdatePicker.js"></script>
<script language="javascript" type="text/javascript" src="template/default/js/jquery.min.js"></script>
<script src="template/default/tree/js/admincp.js?SES" type="text/javascript"></script>
<script charset="utf-8" src="eweb/kindeditor.js"></script>
<script type="text/javascript"> 
function show_help()
{
   mytop=(screen.availHeight-430)/2;
   myleft=(screen.availWidth-800)/2;
   window.open("admin.php?ac=view&fileurl=help&helpid=<?=$fileurl?>","","height=470,width=800,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top="+mytop+",left="+myleft+",resizable=yes");
}
filenumber_show()
function filenumber_show()
{
   jQuery.ajax({
      type: 'GET',
      url: 'admin.php?ac=file&fileurl=public&filenumber=<?=$filenumber?>&officetype=3&'+new Date(),
      success: function(data){
		  if(data!=''){
			  $("#filenumber").html(data);
		  }else{
			  $("#filenumber").html('还没有附件!');
		  }
      }
   });
}
fileoffice_show()
function fileoffice_show()
{
   jQuery.ajax({
      type: 'GET',
      url: 'admin.php?ac=file&do=office&fileurl=public&filenumber=<?=$filenumber?>&officetype=3&'+new Date(),
      success: function(data){
		  if(data!=''){
			  $("#filenumberoffice").html(data);
		  }else{
			  $("#filenumberoffice").html('还没有文档!');
		  }
      }
   });
}
function show_notk()
{
   mytop=(screen.availHeight-600)/2;
   myleft=(screen.availWidth-1002)/2;
   window.open("ntko/FileEdit.php?fileType=word&FileId=51515800000&filenumber=<?=$filenumber?>&officetype=3&uid=<?=$_USER->id?>&date=<?=get_date('Y-m-d H:i:s',PHP_TIME)?>","","height=600,width=1002,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top="+mytop+",left="+myleft+",resizable=yes");
}
</script>
<title>Office 515158 2011 OA办公系统</title>
 
</head>
<body>
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="0" class="small">
  <tr>
    <td class="Big"><img src="template/default/content/images/notify_new.gif" align="absmiddle"><span class="big3"> 工作流创建</span>&nbsp;&nbsp;&nbsp;&nbsp;
	<span style="font-size:12px;"><a href="#" onClick="show_help()" style="font-size:12px;">使用帮助文档？</a>&nbsp;|&nbsp;
	<a href="http://bbs.515158.com/" target="_blank" style="font-size:12px;">使用遇到问题？</a>&nbsp;|&nbsp;
	<a href="admin.php?ac=index&fileurl=<?=$fileurl?>" style="font-size:12px;">返回列表页</a><img src="template/default/content/images/f_ico.png" align="absmiddle"></span>
    </td>
  </tr>
</table>
<script Language="JavaScript"> 
function CheckForm()
{
   if(document.save.userkey.value=="")
   { alert("审批人员不能为空！");
     document.save.userkey.focus();
     return (false);
   }
   if(document.save.number.value=="")
   { alert("流水单号不能为空！");
     document.save.number.focus();
     return (false);
   }
   if(document.save.title.value=="")
   { alert("工作流名称不能为空！");
     document.save.title.focus();
     return (false);
   }
<?
global $db;
$query = $db->query("SELECT * FROM ".DB_TABLEPRE."workclass_form where type_id='".$_GET["workclasstype"]."' and template_id='".$_GET["worktemplate"]."' and unionid='".union_id."' ORDER BY id Asc");
	while ($row = $db->fetch_array($query)) {
		if($row["confirmation"]=='1'){
?>

if(document.save.<?=$row["inputname"]?>.value=="")
   { alert("<?=$row["formname"]?>不能为空！");
     document.save.<?=$row["inputname"]?>.focus();
     return (false);
   }
   
<?php
	}
}
?>
   return true;
}
function sendForm()
{
   if(CheckForm())
      document.save.submit();
}
</script>
<form name="save" method="post" action="?ac=add&do=save&fileurl=work">
	<input type="hidden" name="savetype" value="add" />
	<input type="hidden" name="workclasstype" value="<?=$_GET["workclasstype"]?>" />
	<input type="hidden" name="worktemplate" value="<?=$_GET["worktemplate"]?>" />
	<input type="hidden" name="filenumber" value="<?=$filenumber?>" />
<table class="TableBlock" border="0" width="90%" align="center">
<?php if($_CONFIG->config_data('configoffice')=='1'){?>
  
	 <tr>
      <td nowrap class="TableHeader" colspan="2"><b>&nbsp;正文设置</b></td>
    </tr>  
	<tr>
      <td nowrap class="TableContent" width="15%">文档：</td>
      <td class="TableData" id="filenumberoffice">
	 </td>
    </tr>
	<tr>
      <td nowrap class="TableContent" width="15%">文档操作：</td>
      <td class="TableData">
	  <input type="hidden" name="fileofficeid" class="BigInput"  onpropertychange="fileoffice_show();" />
	  <a href="javascript:;" onClick="show_notk()">+新建word文档</a></td>
    </tr>
	 <? }?>
   <tr>
      <td nowrap class="TableContent" width="15%"> 
        设置审批人员：<? get_user_add_help()?></td>
      <td class="TableData">
	  <?php
	  $blog=$db->fetch_one_array("SELECT workuser,id FROM ".DB_TABLEPRE."workclass_flow WHERE template_id='".$_GET["worktemplate"]."' and type_id='".$_GET["workclasstype"]."' and number='2'  and unionid='".union_id."' ORDER BY id desc LIMIT 1");
	 if($blog['flowtype']=='2'){
	 	get_oa_member_public(1,"userkey",$blog["workuser"],"",120,20);
	 }else{
		get_oa_member_public(1,"userkey",$blog["workuser"],"+选择审批人员",120,20);
	 }
	 ?>
	 <br>
	 <?php get_sms_info_phone_box("审批人员","shownamemaster")?>
	 <input type="hidden" name="flowid" value="<?=$blog["id"]?>" />
	 <br>
	 注：流程第一步审批人员，这里选择你的下一级办理人，必需填写！ 
	 </td>
    </tr>
   
   
	<tr>
      <td nowrap class="TableContent" width="15%"> 
        流水单号：<? get_user_add_help()?></td>
      <td class="TableData">
      <input name="number" type="text" class="BigInput" id="number" style="width: 200px;" value="<?=$number?>" maxlength="100" /> </td>
    </tr>
	<tr>
      <td nowrap class="TableContent" width="15%"> 工作流名称：<? get_user_add_help()?></td>
      <td class="TableData">
      <input type="text" name="title" class="BigInput" style="width:300px;" size="20" value="流水号<?=$number?> <?=trim($tpl["title"]);?>" />
      </td>
    </tr>
<?
global $db;
$query = $db->query("SELECT * FROM ".DB_TABLEPRE."workclass_form where type_id='".$_GET["workclasstype"]."' and template_id='".$_GET["worktemplate"]."' and unionid='".union_id."' ORDER BY id Asc");
	while ($row = $db->fetch_array($query)) {
?>
	<tr>
      <td nowrap class="TableContent" width="15%"> <?=$row["formname"]?>：<?php if($row["confirmation"]=='1'){?><? get_user_add_help()?><?php }?></td>
      <td class="TableData">
<?php
if($row["type"]=='0'){
	if($row["inputtype"]=='1'){
		echo get_work_input($row["inputname"],300,20,$row['inputvalue']);
	}elseif($row["inputtype"]=='2'){
		echo '<textarea name="'.$row["inputname"].'" cols="80" rows="8" class="BigInput"></textarea>';
	}elseif($row["inputtype"]=='3'){
		$inputvaluenum=explode('|',$row["inputvaluenum"]); 
		for($i=0;$i<sizeof($inputvaluenum);$i++){
			echo '<input name="'.$row["inputname"].'" type="radio" value="'.$inputvaluenum[$i].'" ';
			if ($i=='0'){
			echo 'checked="checked"';
			}
			echo '/>'.$inputvaluenum[$i].'';
		}
		
		
	}elseif($row["inputtype"]=='4'){
		$inputvaluenum=explode('|',$row["inputvaluenum"]); 
		for($i=0;$i<sizeof($inputvaluenum);$i++){
			echo '<input name="'.$row["inputname"].'" type="checkbox" value="'.$inputvaluenum[$i].'" ';
			if ($i=='0'){
			echo 'checked="checked"';
			}
			echo '/>'.$inputvaluenum[$i].'';
		}
		
		
	}elseif($row["inputtype"]=='5'){
		$inputvaluenum=explode('|',$row["inputvaluenum"]); 
		echo '<select name="'.$row["inputname"].'" id="'.$row["inputname"].'">';
		echo '<option value="" selected="selected">选择内容</option>';
		for($i=0;$i<sizeof($inputvaluenum);$i++){
			echo '<option value="'.$inputvaluenum[$i].'">'.$inputvaluenum[$i].'</option>';
			
		}
		echo '</select> ';
		
		
	}







}elseif($row["type"]=='1'){
?>
<input type="text" name="<?=$row["inputname"]?>" class="BigInput" size="40" value="" /><a href="#" onClick="window.open ('admin.php?ac=uploadadd&fileurl=public&name=<?=$row["inputname"]?>', 'newwindow', 'height=200, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no')">+上传图片</a>	
<?php
}elseif($row["type"]=='2'){
?>
<input type="text" name="<?=$row["inputname"]?>" class="BigInput" size="40" value="" /><a href="#" onClick="window.open ('admin.php?ac=uploadadd&fileurl=public&name=<?=$row["inputname"]?>', 'newwindow', 'height=200, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no')">+上传附件</a>
<?php
}elseif($row["type"]=='3'){
echo '<input size="10" class="inputdate" style="width:174px;" type="text" value="'.get_date('Y-m-d',PHP_TIME).'" name="'.$row["inputname"].'" onClick="WdatePicker();" />';
}elseif($row["type"]=='4'){
get_oa_department_public(1,$row["inputname"],"","+选择部门",160,20);
}elseif($row["type"]=='5'){
get_oa_member_public(1,$row["inputname"],"","+选择人员",120,20);
}

?>
</td>
    </tr>
<?php
}	
?>
	
    <tr align="center" class="TableControl">
      <td colspan="2" nowrap height="35">
<input type="button" value="保存" class="BigButtonBHover" onClick="sendForm();"> </td>
    </tr>
  </table>
</form>

 
</body>
</html>
